1
general::
Also, by a hairbreadth or whisker. Very narrowly. For example, His serve was out by a hair, or We made our flight by a hairbreadth, or Dad missed hitting the pole by a whisker. The first two hyperboles for the very narrowest margin date from the 1300s and 1400s respectively; whisker meaning "a small amount" was first recorded in 1913. Also see BY THE SKIN OF ONE'S TEETH; HANG BY A HAIR.
American Heritage Idioms
2
general::
Phrase(s): by a hair(‘s breadth) [and] by a whisker
Fig. just barely; by a very small distance. • I just missed getting on the plane by a hair’s breadth. • I made it onto the last flight by a hair!
McGrawhill's American Idioms And Phrasal Verbs